home *** CD-ROM | disk | FTP | other *** search
/ Kit PC World De Ampliacion De Windows 95 / Kit PC World de ampliacion de Windows 95.iso / clarion / cw15 / examp15.z / BLINDS.CLW < prev    next >
Text File  |  1995-09-09  |  5KB  |  157 lines

  1. !==========================================================================!
  2. !Program :BLINDS.EXE
  3. !Author  :Dave Harms
  4. !Purpose :An example of how to display images with a flair
  5. !==========================================================================!
  6. BLINDS                  PROGRAM
  7.  
  8.                         INCLUDE('EQUATES.CLW')
  9.  
  10.                         MAP
  11.                           About()
  12.                         END
  13.  
  14. Control                 BYTE
  15. ImageName               STRING(255)
  16. LastSpinVal             SHORT
  17. Ndx                     BYTE
  18. Spinner                 SHORT(1)
  19. SpinVal                 SHORT
  20.  
  21.  
  22. wBlinds WINDOW('Blinds for Windows'),AT(54,21,169,132),SYSTEM,GRAY,DOUBLE,ICON('Winpyr.ico')
  23.        MENUBAR
  24.          ITEM('E&xit'),STD(STD:Close)
  25.          ITEM('&Images'),USE(?Images)
  26.          ITEM('&About...'),USE(?About)
  27.          ITEM('&Help'),USE(?Help),STD(STD:Help)
  28.        END
  29.        TOOLBAR,AT(,,169,14)
  30.          SPIN(@n3),AT(45,1,6,12),USE(Spinner),IMM,RANGE(1,10)
  31.          PROMPT('Open/Close:'),AT(3,2,,),USE(?Prompt1)
  32.        END
  33.        GROUP,AT(5,4,157,108),USE(?Group1),BOXED
  34.          IMAGE('Toplogo.bmp'),AT(7,10,153,100),USE(?ImageFile)
  35.          BOX,AT(7,4,153,10),USE(?box1),FILL(0828282H)
  36.          BOX,AT(7,14,153,10),USE(?box2),FILL(0828282H)
  37.          BOX,AT(7,24,153,10),USE(?box3),FILL(0828282H)
  38.          BOX,AT(7,34,153,10),USE(?box4),FILL(0828282H)
  39.          BOX,AT(7,44,153,10),USE(?box5),FILL(0828282H)
  40.          BOX,AT(7,54,153,10),USE(?box6),FILL(0828282H)
  41.          BOX,AT(7,64,153,10),USE(?box7),FILL(0828282H)
  42.          BOX,AT(7,74,153,10),USE(?box8),FILL(0828282H)
  43.          BOX,AT(7,84,153,10),USE(?box9),FILL(0828282H)
  44.          BOX,AT(7,94,153,10),USE(?box10),FILL(0828282H)
  45.        END
  46.      END
  47.  
  48.  CODE
  49.  HELP('CW15Exam')
  50.  OPEN(wBlinds)
  51.  DO ShowBlinds
  52.  ACCEPT
  53.    CASE EVENT()
  54.    OF EVENT:CloseDown
  55.      BREAK
  56.    END
  57.    CASE FIELD()
  58.    OF ?Spinner
  59.      CASE EVENT()
  60.      OF EVENT:NewSelection
  61.        DO ShowBlinds
  62.      END
  63.    OF ?Images
  64.      CASE EVENT()
  65.      OF EVENT:Accepted
  66.        ImageName = ''
  67.        IF NOT FileDialog('Blinds For Windows',ImageName,'BitMaps|*.BMP|Gifs|*.GIF|MetaFiles|*.WMF',0)
  68.          POST(EVENT:CloseDown)
  69.        ELSE
  70.          ?ImageFile {PROP:Text} = ImageName
  71.          IF Spinner > 1
  72.            LOOP UNTIL Spinner = 1
  73.              Spinner-=1
  74.              DO ShowBlinds
  75.            END
  76.          END
  77.        END
  78.        DISPLAY()
  79.      END
  80.    OF ?About
  81.      CASE EVENT()
  82.      OF EVENT:Accepted
  83.        About()
  84.      END
  85.    OF ?Help
  86.      CASE EVENT()
  87.      OF EVENT:Accepted
  88.        HELP
  89.      END
  90.    END
  91.  END
  92.  CLOSE(wBlinds)
  93.  RETURN
  94.  
  95. ShowBlinds              ROUTINE
  96.  SpinVal     = 11-Spinner
  97.  IF SpinVal  = LastSpinVal THEN EXIT.
  98.  LastSpinVal = SpinVal
  99.  LOOP Ndx = 1 to 10
  100.    Control = ?Box1-1+Ndx
  101.    Control {PROP:YPos}   = ((Ndx*10)) + ((10-SpinVal)/2)
  102.    Control {PROP:Height} = SpinVal
  103.  END
  104.  EXIT
  105.  
  106. About       procedure               ! An "About box" procedure
  107.  
  108. !-----------------------------------------------------------------------
  109. ! The following CSTRING contains all the text we want to appear in
  110. ! the About box - it will be displayed in a text control with a vertical
  111. ! scroll bar and the READONLY attribute. That way the user can view all
  112. ! the text, but can't change any of it. To force line breaks, we have
  113. ! inserted a Carriage Return/Line Feed combination - <13,10>.
  114. !-----------------------------------------------------------------------
  115.  
  116. AboutText   CSTRING('Blinds, CW Style' & |
  117.                     '<13,10>' & |
  118.                     '<13,10>by Dave Harms & Ross Santos' & |
  119.                     '<13,10>' & |
  120.                     '<13,10>authors of ' & |
  121.                     '<13,10>"Developing Applications in Clarion for Windows"' & |
  122.                     '<13,10>(published by Sams)' & |
  123.                     '<13,10>' & |
  124.                     '<13,10>Dave Harms' & |
  125.                     '<13,10>Compuserve: 72341,446' & |
  126.                     '<13,10>Internet: 72341.446@compuserve.com' & |
  127.                     '<13,10>' & |
  128.                     '<13,10>Ross Santos' & |
  129.                     '<13,10>Compuserve: 71554,637' & |
  130.                     '<13,10>Internet: 71554.637@compuserve.com' & |
  131.                     '<13,10>' & |
  132.                     '<13,10>To use this program: Press and hold down the ' & |
  133.                     'UP/DOWN Arrows on the Spin Button. ' & |
  134.                     'The image will appear or hide under the ' & |
  135.                     'Window Blinds. You can select a different image by ' & |
  136.                     'pressing the IMAGE menu item. <13,10,13,10>')
  137.  
  138. wAbout WINDOW('About Blinds'),AT(28,31,202,112),GRAY
  139.        TEXT,AT(6,4,193,84),USE(AboutText),VSCROLL,CENTER,READONLY
  140.        BUTTON('OK'),AT(84,93,35,14),USE(?OkButton),DEFAULT
  141.      END
  142.  
  143.  
  144.   CODE
  145.   OPEN(wAbout)                      ! Open the window - text will be
  146.   ACCEPT                            ! automatically displayed
  147.     CASE FIELD()
  148.     OF ?OkButton                    ! If the user presses the OK button
  149.       CASE EVENT()                  ! then break out of the loop and
  150.       OF EVENT:Accepted             ! exit the procedure
  151.         BREAK
  152.       END
  153.     END
  154.   END
  155.  
  156.  
  157.